package com.gxa.retail_admin.controller;


import com.gxa.common.vo.JsonResult;
import com.gxa.common.vo.R;
import com.gxa.common.vo.ResultVo;
import com.gxa.modules.service.CommodityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
//http://localhost:8080/swagger-ui.html
@Api(value = "商品中心数据test",tags = "商品中心数据接口API-王梓鑫")
@RequestMapping(value = "/staging/goods")
public class CommodityController {
    @Autowired(required = false)
    private CommodityService commodityService;
    JsonResult jsonResult = new JsonResult();

    @RequestMapping(value = "/queryCommodityMap",method = RequestMethod.GET)
    @RequiresPermissions("商品列表")
    @ApiOperation(value = "商品中心商品列表数据查询接口",notes = "查询商品中心商品列表系统数据",httpMethod = "GET", response = R.class)

    @ApiResponses({
            @ApiResponse(code=200,message = "success"),
            @ApiResponse(code=404,message = "找不到页面，接口或参数错误"),
            @ApiResponse(code=500,message = "后台错误")
    })

    //商品中心数据-商品列表数据查询-接口12.28
    public JsonResult queryCommodityMap(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer limit){

        jsonResult.setCode(200);

        return commodityService.queryCommodityMap(page,limit);

    }


    @RequestMapping(value = "/queryBillchangeMap",method = RequestMethod.GET)
    @RequiresPermissions("调价单")
    @ApiOperation(value = "商品中心调价单数据查询接口",notes = "查询商品中心调价单数据",httpMethod = "GET", response = R.class)

    @ApiResponses({
            @ApiResponse(code=200,message = "success"),
            @ApiResponse(code=404,message = "找不到页面，接口或参数错误"),
            @ApiResponse(code=500,message = "后台错误")
    })
    @ResponseBody
    //商品中心数据-商品调价单数据查询-接口12.28
    public JsonResult queryBillchangeMap(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer limit){

        jsonResult.setCode(200);

        return commodityService.queryBillchangeMap(page,limit);

    }



    @RequestMapping(value = "/searchCommodityByClass",method = RequestMethod.GET)
    @RequiresPermissions("商品分类")
    @ApiOperation(value = "商品分类普通搜索接口",notes = "根据分类搜索商品数据",httpMethod = "GET", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message = "success"),
            @ApiResponse(code=404,message = "找不到页面，接口或参数错误"),
            @ApiResponse(code=500,message = "后台错误")
    })
    @ResponseBody
    //合同管理系统-搜索合同数据-接口   12.08
    public ResultVo searchCommodityByClass(String commodity_class_fst, @RequestParam(defaultValue = " ")String commodity_class_sec){


        return commodityService.searchCommodityByClass(commodity_class_fst,commodity_class_sec);
    }
}
